<template>
	
	<div style="width: 100%;height: 100%;">
	<mu-paper style="position: fixed;left:0 ;bottom: 0;z-index: 200;">
	    <!--<mu-bottom-nav :value="bottomNav"  @change="handleChange" style="background-color:white;position: fixed;left: 0;bottom: 0;box-shadow: 0 -2px 3px rgba(200,200,200,0.2);z-index: 100;">-->
		   <mu-bottom-nav :value="bottomNav"  @change="handleChange" v-show="showNav" style="background-color:white;position: fixed;left: 0;bottom: 0;box-shadow: 0 -2px 3px rgba(200,200,200,0.2);z-index: 100;">
		   <mu-bottom-nav-item value="Q01SaleOrderList" to="/Q01SaleOrderList" title="订单" icon="format_list_bulleted"/>
		   <mu-bottom-nav-item value="Q01GrantBillsList" to="/Q01GrantBillsList" title="线上下单" icon="format_list_bulleted"/>
		   <mu-bottom-nav-item value="Q01ReportIndex" to="/Q01ReportIndex" title="报表" icon="home"/>
		   <mu-bottom-nav-item value="Q01DataCenter" to="/index2" title="返回首页" icon="home"/>
	    </mu-bottom-nav>
	</mu-paper>
	<router-view style="height: 100%;"></router-view>
	</div>
</template>

<script>
	export default{
		data(){
			return { 
    	     bottomNav: 'Q01SaleOrderList',
	         bottomNavColor: 'movies',
	         factoryInfo:{},
	         factoryId:'',
	         
	         
//	         docmHeight: document.documentElement.clientHeight,//默认屏幕高度
//	         showHeight: document.documentElement.clientHeight,//实时屏幕高度
//	         hidshow:true//显示或隐藏导航栏

            clientHeight:document.documentElement.clientHeight,
　　　　　　　showNav: true,  // 控制按钮盒子显示隐藏
	        // msg:'',
    		}
		},
		mounted(){
			
			window.onresize= ()=>{

            if(this.clientHeight>document.documentElement.clientHeight) {

               this.showNav =false

            }else{

                this.showNav = true

            }

        }

			
//			window.onresize = ()=>{
//	  			return(()=>{this.showHeight=document.body.clientHeight;})()
//	  		}
			
			this.factoryId=this.$route.params.factoryId
	  		localStorage.factoryName=this.$route.params.factoryName

	  		var paramData=this.$route.params.factoryId
	  		if(typeof(paramData)!="undefined"){
	  		   localStorage.factoryId=this.$route.params.factoryId
	  		   this.loginFacotry()
	  		}
	  		
	  		
	  		
		},
		methods:{
			handleChange (val) {
	        this.bottomNav = val
			},
			loginFacotry()
    {
    	let that=this;
    	console.info(localStorage.factoryId)
	    that.axios.post('/factoryUser/loginFacotry',{
	      			'factoryId':localStorage.factoryId,
	      			'imei':localStorage.userNumber
	    }).then(function(response){
//			that.factoryInfo
			if(response.data.code!="500"){
				if(response.data.data.state=="ok"){
			     localStorage.organizeId=JSON.stringify(response.data.data.Organizes[0].ID)
			     localStorage.uid=JSON.stringify(response.data.data.UID)
			     console.log(that.factoryInfo)
			     //msg= response.data.msg
			     //that.$message({type: 'info',message: '登录成功',duration:1500});
				}
				else {//提示C#端 正常运行 返回错误信息 如用户名或密码错误  剩下C#运行错误由 SIP 数据中心提示
					that.$router.go(-1)
					that.$message({type: 'info',message: '登录失败,原因:'+response.data.data.msg,duration:1500});
				}
			}else{//提示IDEA捕获错误  如null异常
				that.$router.go(-1)
				that.$message({type: 'info',message: '登录失败,原因:'+response.data.msg,duration:1500});
				
			}
			that.$router.push({
	  		path:'/'+that.bottomNav
	  	})

	    }).catch(function(error){//捕获HBuilder错误 如undefined
	    	that.$router.go(-1)
	      	that.$message({type: 'info',message: '登录失败'+error.Message,duration:1500});
	      	
	      	console.log('登录失败')
	    })
    	}
		},
		watch:{
			showHeight:function(){
				if(this.docmHeight>this.showHeight){
					this.hidshow = false
				}else{
					this.hidshow = true
				}
			}
		}
		
		
	}
	
	
	
	
</script>

<style>

</style>